<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        同步
        异步
      */
      console.log(1); //同步
      setTimeout(() => {
        console.log(2); //异步
        setTimeout(() => {
          console.log(4);
        }, 2000);
      }, 1000);
      console.log(3); //同步
    </script>
  </body>
</html>
